
/*
===============================================================================
                    EntitySpaces Studio by EntitySpaces, LLC
             Persistence Layer and Business Objects for Microsoft .NET
             EntitySpaces(TM) is a legal trademark of EntitySpaces, LLC
                          http://www.entityspaces.net
===============================================================================
EntitySpaces Version : 2012.1.0930.0
EntitySpaces Driver  : SQL
===============================================================================
*/

using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
using System.Linq;
using System.Data;
using System.ComponentModel;
using System.Xml.Serialization;
using System.Runtime.Serialization;

using EntitySpaces.Core;
using EntitySpaces.Interfaces;
using EntitySpaces.DynamicQuery;


using DotNetNuke.Framework.Providers;


namespace DNNspot.PropertyAgentImport
{
	/// <summary>
	/// Encapsulates the 'Ventrian_PropertyAgent_PropertyType' table
	/// </summary>

    [DebuggerDisplay("Data = {Debug}")]
	[Serializable]
	[DataContract]
	[KnownType(typeof(PropertyType))]	
	[XmlType("PropertyType")]
	public partial class PropertyType : esPropertyType
	{	
		[DebuggerBrowsable(DebuggerBrowsableState.RootHidden | DebuggerBrowsableState.Never)]
		protected override esEntityDebuggerView[] Debug
		{
			get { return base.Debug; }
		}

		override public esEntity CreateInstance()
		{
			return new PropertyType();
		}
		
		#region Static Quick Access Methods
		static public void Delete(System.Int32 propertyTypeID)
		{
			var obj = new PropertyType();
			obj.PropertyTypeID = propertyTypeID;
			obj.AcceptChanges();
			obj.MarkAsDeleted();
			obj.Save();
		}

	    static public void Delete(System.Int32 propertyTypeID, esSqlAccessType sqlAccessType)
		{
			var obj = new PropertyType();
			obj.PropertyTypeID = propertyTypeID;
			obj.AcceptChanges();
			obj.MarkAsDeleted();
			obj.Save(sqlAccessType);
		}
		#endregion

		
					
		
	
	}



    [DebuggerDisplay("Count = {Count}")]
	[Serializable]
	[CollectionDataContract]
	[XmlType("PropertyTypeCollection")]
	public partial class PropertyTypeCollection : esPropertyTypeCollection, IEnumerable<PropertyType>
	{
		public PropertyType FindByPrimaryKey(System.Int32 propertyTypeID)
		{
			return this.SingleOrDefault(e => e.PropertyTypeID == propertyTypeID);
		}

		
		
		#region WCF Service Class
		
		[DataContract]
		[KnownType(typeof(PropertyType))]
		public class PropertyTypeCollectionWCFPacket : esCollectionWCFPacket<PropertyTypeCollection>
		{
			public static implicit operator PropertyTypeCollection(PropertyTypeCollectionWCFPacket packet)
			{
				return packet.Collection;
			}

			public static implicit operator PropertyTypeCollectionWCFPacket(PropertyTypeCollection collection)
			{
				return new PropertyTypeCollectionWCFPacket() { Collection = collection };
			}
		}
		
		#endregion
		
				
	}



    [DebuggerDisplay("Query = {Parse()}")]
	[Serializable]	
	public partial class PropertyTypeQuery : esPropertyTypeQuery
	{
		public PropertyTypeQuery(string joinAlias)
		{
			this.es.JoinAlias = joinAlias;
		}	

		override protected string GetQueryName()
		{
			return "PropertyTypeQuery";
		}
		
					
	
		#region Explicit Casts
		
		public static explicit operator string(PropertyTypeQuery query)
		{
			return PropertyTypeQuery.SerializeHelper.ToXml(query);
		}

		public static explicit operator PropertyTypeQuery(string query)
		{
			return (PropertyTypeQuery)PropertyTypeQuery.SerializeHelper.FromXml(query, typeof(PropertyTypeQuery));
		}
		
		#endregion		
	}

	[DataContract]
	[Serializable]
	abstract public partial class esPropertyType : esEntity
	{
		public esPropertyType()
		{

		}
		
		#region LoadByPrimaryKey
		public virtual bool LoadByPrimaryKey(System.Int32 propertyTypeID)
		{
			if(this.es.Connection.SqlAccessType == esSqlAccessType.DynamicSQL)
				return LoadByPrimaryKeyDynamic(propertyTypeID);
			else
				return LoadByPrimaryKeyStoredProcedure(propertyTypeID);
		}

		public virtual bool LoadByPrimaryKey(esSqlAccessType sqlAccessType, System.Int32 propertyTypeID)
		{
			if (sqlAccessType == esSqlAccessType.DynamicSQL)
				return LoadByPrimaryKeyDynamic(propertyTypeID);
			else
				return LoadByPrimaryKeyStoredProcedure(propertyTypeID);
		}

		private bool LoadByPrimaryKeyDynamic(System.Int32 propertyTypeID)
		{
			PropertyTypeQuery query = new PropertyTypeQuery();
			query.Where(query.PropertyTypeID == propertyTypeID);
			return this.Load(query);
		}

		private bool LoadByPrimaryKeyStoredProcedure(System.Int32 propertyTypeID)
		{
			esParameters parms = new esParameters();
			parms.Add("PropertyTypeID", propertyTypeID);
			return this.Load(esQueryType.StoredProcedure, this.es.spLoadByPrimaryKey, parms);
		}
		#endregion
		
		#region Properties
		
		
		
		/// <summary>
		/// Maps to Ventrian_PropertyAgent_PropertyType.PropertyTypeID
		/// </summary>
		[DataMember(EmitDefaultValue=false)]
		virtual public System.Int32? PropertyTypeID
		{
			get
			{
				return base.GetSystemInt32(PropertyTypeMetadata.ColumnNames.PropertyTypeID);
			}
			
			set
			{
				if(base.SetSystemInt32(PropertyTypeMetadata.ColumnNames.PropertyTypeID, value))
				{
					OnPropertyChanged(PropertyTypeMetadata.PropertyNames.PropertyTypeID);
				}
			}
		}		
		
		/// <summary>
		/// Maps to Ventrian_PropertyAgent_PropertyType.ModuleID
		/// </summary>
		[DataMember(EmitDefaultValue=false)]
		virtual public System.Int32? ModuleID
		{
			get
			{
				return base.GetSystemInt32(PropertyTypeMetadata.ColumnNames.ModuleID);
			}
			
			set
			{
				if(base.SetSystemInt32(PropertyTypeMetadata.ColumnNames.ModuleID, value))
				{
					OnPropertyChanged(PropertyTypeMetadata.PropertyNames.ModuleID);
				}
			}
		}		
		
		/// <summary>
		/// Maps to Ventrian_PropertyAgent_PropertyType.Name
		/// </summary>
		[DataMember(EmitDefaultValue=false)]
		virtual public System.String Name
		{
			get
			{
				return base.GetSystemString(PropertyTypeMetadata.ColumnNames.Name);
			}
			
			set
			{
				if(base.SetSystemString(PropertyTypeMetadata.ColumnNames.Name, value))
				{
					OnPropertyChanged(PropertyTypeMetadata.PropertyNames.Name);
				}
			}
		}		
		
		/// <summary>
		/// Maps to Ventrian_PropertyAgent_PropertyType.Description
		/// </summary>
		[DataMember(EmitDefaultValue=false)]
		virtual public System.String Description
		{
			get
			{
				return base.GetSystemString(PropertyTypeMetadata.ColumnNames.Description);
			}
			
			set
			{
				if(base.SetSystemString(PropertyTypeMetadata.ColumnNames.Description, value))
				{
					OnPropertyChanged(PropertyTypeMetadata.PropertyNames.Description);
				}
			}
		}		
		
		/// <summary>
		/// Maps to Ventrian_PropertyAgent_PropertyType.SortOrder
		/// </summary>
		[DataMember(EmitDefaultValue=false)]
		virtual public System.Int32? SortOrder
		{
			get
			{
				return base.GetSystemInt32(PropertyTypeMetadata.ColumnNames.SortOrder);
			}
			
			set
			{
				if(base.SetSystemInt32(PropertyTypeMetadata.ColumnNames.SortOrder, value))
				{
					OnPropertyChanged(PropertyTypeMetadata.PropertyNames.SortOrder);
				}
			}
		}		
		
		/// <summary>
		/// Maps to Ventrian_PropertyAgent_PropertyType.IsPublished
		/// </summary>
		[DataMember(EmitDefaultValue=false)]
		virtual public System.Boolean? IsPublished
		{
			get
			{
				return base.GetSystemBoolean(PropertyTypeMetadata.ColumnNames.IsPublished);
			}
			
			set
			{
				if(base.SetSystemBoolean(PropertyTypeMetadata.ColumnNames.IsPublished, value))
				{
					OnPropertyChanged(PropertyTypeMetadata.PropertyNames.IsPublished);
				}
			}
		}		
		
		/// <summary>
		/// Maps to Ventrian_PropertyAgent_PropertyType.ParentID
		/// </summary>
		[DataMember(EmitDefaultValue=false)]
		virtual public System.Int32? ParentID
		{
			get
			{
				return base.GetSystemInt32(PropertyTypeMetadata.ColumnNames.ParentID);
			}
			
			set
			{
				if(base.SetSystemInt32(PropertyTypeMetadata.ColumnNames.ParentID, value))
				{
					OnPropertyChanged(PropertyTypeMetadata.PropertyNames.ParentID);
				}
			}
		}		
		
		/// <summary>
		/// Maps to Ventrian_PropertyAgent_PropertyType.ImageFile
		/// </summary>
		[DataMember(EmitDefaultValue=false)]
		virtual public System.String ImageFile
		{
			get
			{
				return base.GetSystemString(PropertyTypeMetadata.ColumnNames.ImageFile);
			}
			
			set
			{
				if(base.SetSystemString(PropertyTypeMetadata.ColumnNames.ImageFile, value))
				{
					OnPropertyChanged(PropertyTypeMetadata.PropertyNames.ImageFile);
				}
			}
		}		
		
		/// <summary>
		/// Maps to Ventrian_PropertyAgent_PropertyType.AllowProperties
		/// </summary>
		[DataMember(EmitDefaultValue=false)]
		virtual public System.Boolean? AllowProperties
		{
			get
			{
				return base.GetSystemBoolean(PropertyTypeMetadata.ColumnNames.AllowProperties);
			}
			
			set
			{
				if(base.SetSystemBoolean(PropertyTypeMetadata.ColumnNames.AllowProperties, value))
				{
					OnPropertyChanged(PropertyTypeMetadata.PropertyNames.AllowProperties);
				}
			}
		}		
		
		#endregion	

		#region .str() Properties
		
		public override void SetProperties(IDictionary values)
		{
			foreach (string propertyName in values.Keys)
			{
				this.SetProperty(propertyName, values[propertyName]);
			}
		}
		
		public override void SetProperty(string name, object value)
		{
			esColumnMetadata col = this.Meta.Columns.FindByPropertyName(name);
			if (col != null)
			{
				if(value == null || value is System.String)
				{				
					// Use the strongly typed property
					switch (name)
					{							
						case "PropertyTypeID": this.str().PropertyTypeID = (string)value; break;							
						case "ModuleID": this.str().ModuleID = (string)value; break;							
						case "Name": this.str().Name = (string)value; break;							
						case "Description": this.str().Description = (string)value; break;							
						case "SortOrder": this.str().SortOrder = (string)value; break;							
						case "IsPublished": this.str().IsPublished = (string)value; break;							
						case "ParentID": this.str().ParentID = (string)value; break;							
						case "ImageFile": this.str().ImageFile = (string)value; break;							
						case "AllowProperties": this.str().AllowProperties = (string)value; break;
					}
				}
				else
				{
					switch (name)
					{	
						case "PropertyTypeID":
						
							if (value == null || value is System.Int32)
								this.PropertyTypeID = (System.Int32?)value;
								OnPropertyChanged(PropertyTypeMetadata.PropertyNames.PropertyTypeID);
							break;
						
						case "ModuleID":
						
							if (value == null || value is System.Int32)
								this.ModuleID = (System.Int32?)value;
								OnPropertyChanged(PropertyTypeMetadata.PropertyNames.ModuleID);
							break;
						
						case "SortOrder":
						
							if (value == null || value is System.Int32)
								this.SortOrder = (System.Int32?)value;
								OnPropertyChanged(PropertyTypeMetadata.PropertyNames.SortOrder);
							break;
						
						case "IsPublished":
						
							if (value == null || value is System.Boolean)
								this.IsPublished = (System.Boolean?)value;
								OnPropertyChanged(PropertyTypeMetadata.PropertyNames.IsPublished);
							break;
						
						case "ParentID":
						
							if (value == null || value is System.Int32)
								this.ParentID = (System.Int32?)value;
								OnPropertyChanged(PropertyTypeMetadata.PropertyNames.ParentID);
							break;
						
						case "AllowProperties":
						
							if (value == null || value is System.Boolean)
								this.AllowProperties = (System.Boolean?)value;
								OnPropertyChanged(PropertyTypeMetadata.PropertyNames.AllowProperties);
							break;
					

						default:
							break;
					}
				}
			}
            else if (this.ContainsColumn(name))
            {
                this.SetColumn(name, value);
            }
			else
			{
				throw new Exception("SetProperty Error: '" + name + "' not found");
			}
		}		

		public esStrings str()
		{
			if (esstrings == null)
			{
				esstrings = new esStrings(this);
			}
			return esstrings;
		}

		sealed public class esStrings
		{
			public esStrings(esPropertyType entity)
			{
				this.entity = entity;
			}
			
	
			public System.String PropertyTypeID
			{
				get
				{
					System.Int32? data = entity.PropertyTypeID;
					return (data == null) ? String.Empty : Convert.ToString(data);
				}

				set
				{
					if (value == null || value.Length == 0) entity.PropertyTypeID = null;
					else entity.PropertyTypeID = Convert.ToInt32(value);
				}
			}
				
			public System.String ModuleID
			{
				get
				{
					System.Int32? data = entity.ModuleID;
					return (data == null) ? String.Empty : Convert.ToString(data);
				}

				set
				{
					if (value == null || value.Length == 0) entity.ModuleID = null;
					else entity.ModuleID = Convert.ToInt32(value);
				}
			}
				
			public System.String Name
			{
				get
				{
					System.String data = entity.Name;
					return (data == null) ? String.Empty : Convert.ToString(data);
				}

				set
				{
					if (value == null || value.Length == 0) entity.Name = null;
					else entity.Name = Convert.ToString(value);
				}
			}
				
			public System.String Description
			{
				get
				{
					System.String data = entity.Description;
					return (data == null) ? String.Empty : Convert.ToString(data);
				}

				set
				{
					if (value == null || value.Length == 0) entity.Description = null;
					else entity.Description = Convert.ToString(value);
				}
			}
				
			public System.String SortOrder
			{
				get
				{
					System.Int32? data = entity.SortOrder;
					return (data == null) ? String.Empty : Convert.ToString(data);
				}

				set
				{
					if (value == null || value.Length == 0) entity.SortOrder = null;
					else entity.SortOrder = Convert.ToInt32(value);
				}
			}
				
			public System.String IsPublished
			{
				get
				{
					System.Boolean? data = entity.IsPublished;
					return (data == null) ? String.Empty : Convert.ToString(data);
				}

				set
				{
					if (value == null || value.Length == 0) entity.IsPublished = null;
					else entity.IsPublished = Convert.ToBoolean(value);
				}
			}
				
			public System.String ParentID
			{
				get
				{
					System.Int32? data = entity.ParentID;
					return (data == null) ? String.Empty : Convert.ToString(data);
				}

				set
				{
					if (value == null || value.Length == 0) entity.ParentID = null;
					else entity.ParentID = Convert.ToInt32(value);
				}
			}
				
			public System.String ImageFile
			{
				get
				{
					System.String data = entity.ImageFile;
					return (data == null) ? String.Empty : Convert.ToString(data);
				}

				set
				{
					if (value == null || value.Length == 0) entity.ImageFile = null;
					else entity.ImageFile = Convert.ToString(value);
				}
			}
				
			public System.String AllowProperties
			{
				get
				{
					System.Boolean? data = entity.AllowProperties;
					return (data == null) ? String.Empty : Convert.ToString(data);
				}

				set
				{
					if (value == null || value.Length == 0) entity.AllowProperties = null;
					else entity.AllowProperties = Convert.ToBoolean(value);
				}
			}
			

			private esPropertyType entity;
		}
		
		[NonSerialized]
		private esStrings esstrings;		
		
		#endregion
		
		#region Housekeeping methods

		override protected IMetadata Meta
		{
			get
			{
				return PropertyTypeMetadata.Meta();
			}
		}

		#endregion		
		
		#region Query Logic

		public PropertyTypeQuery Query
		{
			get
			{
				if (this.query == null)
				{
					this.query = new PropertyTypeQuery();
					InitQuery(this.query);
				}

				return this.query;
			}
		}

		public bool Load(PropertyTypeQuery query)
		{
			this.query = query;
			InitQuery(this.query);
			return this.Query.Load();
		}
		
		protected void InitQuery(PropertyTypeQuery query)
		{
			query.OnLoadDelegate = this.OnQueryLoaded;
			
			if (!query.es2.HasConnection)
			{
				query.es2.Connection = ((IEntity)this).Connection;
			}			
		}

		#endregion
		
        [IgnoreDataMember]
		private PropertyTypeQuery query;		
	}



	[Serializable]
	abstract public partial class esPropertyTypeCollection : esEntityCollection<PropertyType>
	{
		#region Housekeeping methods
		override protected IMetadata Meta
		{
			get
			{
				return PropertyTypeMetadata.Meta();
			}
		}

		protected override string GetCollectionName()
		{
			return "PropertyTypeCollection";
		}

		#endregion		
		
		#region Query Logic

	#if (!WindowsCE)
		[BrowsableAttribute(false)]
	#endif
		public PropertyTypeQuery Query
		{
			get
			{
				if (this.query == null)
				{
					this.query = new PropertyTypeQuery();
					InitQuery(this.query);
				}

				return this.query;
			}
		}

		public bool Load(PropertyTypeQuery query)
		{
			this.query = query;
			InitQuery(this.query);
			return Query.Load();
		}

		override protected esDynamicQuery GetDynamicQuery()
		{
			if (this.query == null)
			{
				this.query = new PropertyTypeQuery();
				this.InitQuery(query);
			}
			return this.query;
		}

		protected void InitQuery(PropertyTypeQuery query)
		{
			query.OnLoadDelegate = this.OnQueryLoaded;
			
			if (!query.es2.HasConnection)
			{
				query.es2.Connection = ((IEntityCollection)this).Connection;
			}			
		}

		protected override void HookupQuery(esDynamicQuery query)
		{
			this.InitQuery((PropertyTypeQuery)query);
		}

		#endregion
		
		private PropertyTypeQuery query;
	}



	[Serializable]
	abstract public partial class esPropertyTypeQuery : esDynamicQuery
	{
		override protected IMetadata Meta
		{
			get
			{
				return PropertyTypeMetadata.Meta();
			}
		}	
		
		#region QueryItemFromName
		
        protected override esQueryItem QueryItemFromName(string name)
        {
            switch (name)
            {
				case "PropertyTypeID": return this.PropertyTypeID;
				case "ModuleID": return this.ModuleID;
				case "Name": return this.Name;
				case "Description": return this.Description;
				case "SortOrder": return this.SortOrder;
				case "IsPublished": return this.IsPublished;
				case "ParentID": return this.ParentID;
				case "ImageFile": return this.ImageFile;
				case "AllowProperties": return this.AllowProperties;

                default: return null;
            }
        }		
		
		#endregion
		
		#region esQueryItems

		public esQueryItem PropertyTypeID
		{
			get { return new esQueryItem(this, PropertyTypeMetadata.ColumnNames.PropertyTypeID, esSystemType.Int32); }
		} 
		
		public esQueryItem ModuleID
		{
			get { return new esQueryItem(this, PropertyTypeMetadata.ColumnNames.ModuleID, esSystemType.Int32); }
		} 
		
		public esQueryItem Name
		{
			get { return new esQueryItem(this, PropertyTypeMetadata.ColumnNames.Name, esSystemType.String); }
		} 
		
		public esQueryItem Description
		{
			get { return new esQueryItem(this, PropertyTypeMetadata.ColumnNames.Description, esSystemType.String); }
		} 
		
		public esQueryItem SortOrder
		{
			get { return new esQueryItem(this, PropertyTypeMetadata.ColumnNames.SortOrder, esSystemType.Int32); }
		} 
		
		public esQueryItem IsPublished
		{
			get { return new esQueryItem(this, PropertyTypeMetadata.ColumnNames.IsPublished, esSystemType.Boolean); }
		} 
		
		public esQueryItem ParentID
		{
			get { return new esQueryItem(this, PropertyTypeMetadata.ColumnNames.ParentID, esSystemType.Int32); }
		} 
		
		public esQueryItem ImageFile
		{
			get { return new esQueryItem(this, PropertyTypeMetadata.ColumnNames.ImageFile, esSystemType.String); }
		} 
		
		public esQueryItem AllowProperties
		{
			get { return new esQueryItem(this, PropertyTypeMetadata.ColumnNames.AllowProperties, esSystemType.Boolean); }
		} 
		
		#endregion
		
	}


	
	public partial class PropertyType : esPropertyType
	{

		
		
	}
	



	[Serializable]
	public partial class PropertyTypeMetadata : esMetadata, IMetadata
	{
		#region Protected Constructor
		protected PropertyTypeMetadata()
		{
			m_columns = new esColumnMetadataCollection();
			esColumnMetadata c;

			c = new esColumnMetadata(PropertyTypeMetadata.ColumnNames.PropertyTypeID, 0, typeof(System.Int32), esSystemType.Int32);
			c.PropertyName = PropertyTypeMetadata.PropertyNames.PropertyTypeID;
			c.IsInPrimaryKey = true;
			c.IsAutoIncrement = true;
			c.NumericPrecision = 10;
			m_columns.Add(c);
				
			c = new esColumnMetadata(PropertyTypeMetadata.ColumnNames.ModuleID, 1, typeof(System.Int32), esSystemType.Int32);
			c.PropertyName = PropertyTypeMetadata.PropertyNames.ModuleID;
			c.NumericPrecision = 10;
			m_columns.Add(c);
				
			c = new esColumnMetadata(PropertyTypeMetadata.ColumnNames.Name, 2, typeof(System.String), esSystemType.String);
			c.PropertyName = PropertyTypeMetadata.PropertyNames.Name;
			c.CharacterMaxLength = 50;
			m_columns.Add(c);
				
			c = new esColumnMetadata(PropertyTypeMetadata.ColumnNames.Description, 3, typeof(System.String), esSystemType.String);
			c.PropertyName = PropertyTypeMetadata.PropertyNames.Description;
			c.CharacterMaxLength = 1073741823;
			c.IsNullable = true;
			m_columns.Add(c);
				
			c = new esColumnMetadata(PropertyTypeMetadata.ColumnNames.SortOrder, 4, typeof(System.Int32), esSystemType.Int32);
			c.PropertyName = PropertyTypeMetadata.PropertyNames.SortOrder;
			c.NumericPrecision = 10;
			c.HasDefault = true;
			c.Default = @"((0))";
			m_columns.Add(c);
				
			c = new esColumnMetadata(PropertyTypeMetadata.ColumnNames.IsPublished, 5, typeof(System.Boolean), esSystemType.Boolean);
			c.PropertyName = PropertyTypeMetadata.PropertyNames.IsPublished;
			m_columns.Add(c);
				
			c = new esColumnMetadata(PropertyTypeMetadata.ColumnNames.ParentID, 6, typeof(System.Int32), esSystemType.Int32);
			c.PropertyName = PropertyTypeMetadata.PropertyNames.ParentID;
			c.NumericPrecision = 10;
			c.HasDefault = true;
			c.Default = @"((-1))";
			m_columns.Add(c);
				
			c = new esColumnMetadata(PropertyTypeMetadata.ColumnNames.ImageFile, 7, typeof(System.String), esSystemType.String);
			c.PropertyName = PropertyTypeMetadata.PropertyNames.ImageFile;
			c.CharacterMaxLength = 255;
			c.IsNullable = true;
			m_columns.Add(c);
				
			c = new esColumnMetadata(PropertyTypeMetadata.ColumnNames.AllowProperties, 8, typeof(System.Boolean), esSystemType.Boolean);
			c.PropertyName = PropertyTypeMetadata.PropertyNames.AllowProperties;
			c.HasDefault = true;
			c.Default = @"((1))";
			m_columns.Add(c);
				
		}
		#endregion	
	
		static public PropertyTypeMetadata Meta()
		{
			return meta;
		}	
		
		public Guid DataID
		{
			get { return base.m_dataID; }
		}	
		
		public bool MultiProviderMode
		{
			get { return false; }
		}		

		public esColumnMetadataCollection Columns
		{
			get	{ return base.m_columns; }
		}
		
		#region ColumnNames
		public class ColumnNames
		{ 
			 public const string PropertyTypeID = "PropertyTypeID";
			 public const string ModuleID = "ModuleID";
			 public const string Name = "Name";
			 public const string Description = "Description";
			 public const string SortOrder = "SortOrder";
			 public const string IsPublished = "IsPublished";
			 public const string ParentID = "ParentID";
			 public const string ImageFile = "ImageFile";
			 public const string AllowProperties = "AllowProperties";
		}
		#endregion	
		
		#region PropertyNames
		public class PropertyNames
		{ 
			 public const string PropertyTypeID = "PropertyTypeID";
			 public const string ModuleID = "ModuleID";
			 public const string Name = "Name";
			 public const string Description = "Description";
			 public const string SortOrder = "SortOrder";
			 public const string IsPublished = "IsPublished";
			 public const string ParentID = "ParentID";
			 public const string ImageFile = "ImageFile";
			 public const string AllowProperties = "AllowProperties";
		}
		#endregion	

		public esProviderSpecificMetadata GetProviderMetadata(string mapName)
		{
			MapToMeta mapMethod = mapDelegates[mapName];

			if (mapMethod != null)
				return mapMethod(mapName);
			else
				return null;
		}
		
		#region MAP esDefault
		
		static private int RegisterDelegateesDefault()
		{
			// This is only executed once per the life of the application
			lock (typeof(PropertyTypeMetadata))
			{
				if(PropertyTypeMetadata.mapDelegates == null)
				{
					PropertyTypeMetadata.mapDelegates = new Dictionary<string,MapToMeta>();
				}
				
				if (PropertyTypeMetadata.meta == null)
				{
					PropertyTypeMetadata.meta = new PropertyTypeMetadata();
				}
				
				MapToMeta mapMethod = new MapToMeta(meta.esDefault);
				mapDelegates.Add("esDefault", mapMethod);
				mapMethod("esDefault");
			}
			return 0;
		}			

		private esProviderSpecificMetadata esDefault(string mapName)
		{
			if(!m_providerMetadataMaps.ContainsKey(mapName))
			{
				esProviderSpecificMetadata meta = new esProviderSpecificMetadata();			


				meta.AddTypeMap("PropertyTypeID", new esTypeMap("int", "System.Int32"));
				meta.AddTypeMap("ModuleID", new esTypeMap("int", "System.Int32"));
				meta.AddTypeMap("Name", new esTypeMap("nvarchar", "System.String"));
				meta.AddTypeMap("Description", new esTypeMap("ntext", "System.String"));
				meta.AddTypeMap("SortOrder", new esTypeMap("int", "System.Int32"));
				meta.AddTypeMap("IsPublished", new esTypeMap("bit", "System.Boolean"));
				meta.AddTypeMap("ParentID", new esTypeMap("int", "System.Int32"));
				meta.AddTypeMap("ImageFile", new esTypeMap("nvarchar", "System.String"));
				meta.AddTypeMap("AllowProperties", new esTypeMap("bit", "System.Boolean"));			
				
				
				
				ProviderConfiguration providerConfiguration = ProviderConfiguration.GetProviderConfiguration("data");
				Provider provider = (Provider)providerConfiguration.Providers[providerConfiguration.DefaultProvider];

				string objectQualifier = provider.Attributes["objectQualifier"];

				if ((objectQualifier != string.Empty) && (objectQualifier.EndsWith("_") == false))
				{
					objectQualifier += "_";
				}

				if (objectQualifier != string.Empty)
				{
					meta.Source = objectQualifier + "Ventrian_PropertyAgent_PropertyType";
					meta.Destination = objectQualifier + "Ventrian_PropertyAgent_PropertyType";
					
					meta.spInsert = objectQualifier + "proc_Ventrian_PropertyAgent_PropertyTypeInsert";				
					meta.spUpdate = objectQualifier + "proc_Ventrian_PropertyAgent_PropertyTypeUpdate";		
					meta.spDelete = objectQualifier + "proc_Ventrian_PropertyAgent_PropertyTypeDelete";
					meta.spLoadAll = objectQualifier + "proc_Ventrian_PropertyAgent_PropertyTypeLoadAll";
					meta.spLoadByPrimaryKey = objectQualifier + "proc_Ventrian_PropertyAgent_PropertyTypeLoadByPrimaryKey";
				}
				else
				{
					meta.Source = "Ventrian_PropertyAgent_PropertyType";
					meta.Destination = "Ventrian_PropertyAgent_PropertyType";
									
					meta.spInsert = "proc_Ventrian_PropertyAgent_PropertyTypeInsert";				
					meta.spUpdate = "proc_Ventrian_PropertyAgent_PropertyTypeUpdate";		
					meta.spDelete = "proc_Ventrian_PropertyAgent_PropertyTypeDelete";
					meta.spLoadAll = "proc_Ventrian_PropertyAgent_PropertyTypeLoadAll";
					meta.spLoadByPrimaryKey = "proc_Ventrian_PropertyAgent_PropertyTypeLoadByPrimaryKey";
				}
				
				
				this.m_providerMetadataMaps["esDefault"] = meta;
			}
			
			return this.m_providerMetadataMaps["esDefault"];
		}

		#endregion

		static private PropertyTypeMetadata meta;
		static protected Dictionary<string, MapToMeta> mapDelegates;
		static private int _esDefault = RegisterDelegateesDefault();
	}
}
